#include <iostream>
using namespace std;
#include <string>

int main(int argc, char **argv)
{
#if 0
	//录入
	string s1, s2;

	cout << "input two string: ";
	cin >> s1 >> s2;

#endif
#if 0
	string big  = s1 > s2 ? s1 : s2;
	cout << "big: " << big << endl;
#endif

#if 0
	string lengh = s1.size() > s2.size() ? s1 : s2;
	cout << "lengh: " << lengh << endl;
#endif
	string str;
	cout << "input string: ";
	cin >> str;
	
	//1 下标遍历
	for(int i = 0; i < str.size(); i++){
		cout << str[i] << " ";
	}
	cout << endl;

	//2 迭代器遍历
	/*
		string::iterator string的迭代器类型(指针)
		begin() 首元素迭代器 （指向第一个元素）
		end()	尾迭代器 （最后一个元素的下一个位置）
	*/
	for(string::iterator it = str.begin(); it != str.end(); it++){
		cout << *it << " ";
	}
	cout << endl;

	auto i = 100;			//int
	auto p = 3.14;			//double
	auto c = 'c';			//char

	//3 基于范围的for循环   (c++11)
	for(auto i : str){			//abcde
		cout << i << " ";
	}
	cout << endl;

/*
	map<char, int> myMap;
	pair<map<char, int>::iterator, bool> = ;
	auto ret  = myMap.insert(pair<char, int>('3',4));
*/

	return 0;
}
